package com.mofeng.myshop.mapper;

import com.mofeng.myshop.domain.po.RefreshToken;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 用户登录相关 Mapper 接口
 * </p>
 *
 * @author MoFeng
 * @since 2024-04-17
 */
public interface RefreshTokenMapper extends BaseMapper<RefreshToken> {
    @Select("SELECT * FROM `tb_refresh_token` WHERE `user_id` = #{id}")
    RefreshToken findByUserId(@Param("id") Long id);

    @Select("SELECT * FROM `tb_refresh_token` WHERE `mobile_token_key` = #{tokenKey}")
    RefreshToken findByMobileTokenKey(@Param("tokenKey")String tokenKey);

    @Select("SELECT * FROM `tb_refresh_token` WHERE `pc_token_key` = #{tokenKey}")
    RefreshToken findByPcTokenKey(@Param("tokenKey")String tokenKey);
}
